﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PythonModPacker.helper
{
    class FileHelper
    {
        public static void CopyFolder(String srcFolder, String destFolder,bool copyModJson)
        {   
            if (!Directory.Exists(destFolder))
            {
                Directory.CreateDirectory(destFolder);
            }
            foreach (var item in Directory.EnumerateFiles(srcFolder))
            {
                if (item.EndsWith("mod.json") && !copyModJson)
                {
                    continue;
                }
                File.Copy(item, Path.Combine(destFolder, Path.GetFileName(item)), true);
            }
            foreach (var item in Directory.EnumerateDirectories(srcFolder))
            {
                CopyFolder(item, Path.Combine(destFolder, Path.GetFileName(item)),copyModJson);
            }
        }
    }
}
